import { getToken } from '@/utils/storage'
import {tokenInfo} from '../types/data'
import {loginAction} from '../types/store'
// 初始化state 优先从本地拿 没有就是空对象
const initState=getToken()||{
    token:'',
    refresh_token:''
}
// 用户登录的action
const login=(state:tokenInfo=initState,action:loginAction)=>{
    if(action.type==="login/getInfo") {
        return action.payload
    }
    return state
}
export default login